package com.iuie.ns.web.tags;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.tagext.TagSupport;

import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;

public class AbstractTag extends TagSupport {

	private static final long serialVersionUID = 6274009056595483584L;

	public String getBasePath() {
		HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
		return request.getContextPath();
	}
	
	public String getVersion(){
		WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();    
		ServletContext servletContext = webApplicationContext.getServletContext();
		return (String) servletContext.getAttribute("resourceVersion");
	}
	
}
